package com.hd.manager.shiro.sevice;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hd.appcommon.entity.Teacher;
import com.hd.appcommon.entity.User;
import com.hd.appcommon.mapper.TeacherMapper;
import com.hd.appcommon.mapper.UserMapper;
import com.hd.hdxgddcommon.utils.StringUtils;
import org.springframework.stereotype.Service;

/**
 * <p>
 * shiro adminService 实现类
 * </p>
 *
 * @author Administrator
 * @since 2019-04-19
 */
@Service
public class ShiroAdminServiceImpl extends ServiceImpl<UserMapper, User> implements IShiroAdminService {

    @Override
    public User getByAccount(String account, String password) {
        LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(User::getPhone, account);
        wrapper.eq(StringUtils.isNotBlank(password),User::getPassword, password);
        wrapper.last("  limit 1 ");
        return this.baseMapper.selectOne(wrapper);
    }

}
